﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XNA.BLEND.dom {
  internal class SDNAField {
    internal SDNAField( dynamic sdna, int type, int name ) {
      this.SDNA = sdna;

      this.Type = type;
      this.Name = name;

      this.SDNAName = this.SDNA.Names[this.Name];
      this.SDNAType = this.SDNA.Types[this.Type];
    }

    internal bool IsArray {
      get { return this.SDNAName.IsArray; }
    }

    internal bool IsPointer {
      get { return this.SDNAName.IsPointer; }
    }

    internal bool IsStruct {
      get { return !this.IsPointer && this.Type > SDNAType.LastSimpleType; }
    }

    internal SDNAStruct Struct {
      get { return this.SDNA.TypeStructs[this.Type]; }
    }

    internal string ArrayIndexes {
      get { return this.SDNAName.ArrayIndexes; }
    }

    internal string TypeName {
      get { return this.SDNAType.ID; }
    }

    internal int Type;
    internal int Name;

    private SDNAName SDNAName;
    private SDNAType SDNAType;

    internal dynamic SDNA = null;
  }
}
